<template>
	<view class="content">
		<u-empty v-if="pathAttractionList.length <= 0" mode="list" width="50%" textSize="30"
			icon="http://cdn.uviewui.com/uview/empty/list.png">
		</u-empty>
		<view class="travel" v-for="(item, index) in pathAttractionList" :key="index" @click="goDetails(item.id)">
			<view class="title">
				<text></text>
				<text>{{item.name}}</text>
			</view>
			<u-scroll-list :indicator="false">
				<view class="u-scroll" v-for="(i, d) in item.pathAttractionList" :key="d">
					<image class="scroll-boxImage"
						:src="i.attractionImages? $u.fileBaseUrl + i.attractionImages.split(',')[0]:'../../static/images/index/zwtp.png'">
					</image>
					<view class="scroll-title">
						{{i.attractionName}}
					</view>
					<view class="scroll-bottom">
						<!-- <view class="scroll-bottom-left">
							<image class="scroll-bottom-image" :src="item.picture"></image>
							<view class="scroll-bottom-name">
								{{item.name}}
							</view>
						</view>
						<view class="scroll-bottom-right">
							<uni-icons type="eye" size="20" color="#999999"></uni-icons>
							<text class="scroll-bottom-right-browse">{{item.browse}}</text>
						</view> -->
					</view>
				</view>
			</u-scroll-list>
		</view>
		<!-- 	<view class="customizedRoute">
			<button class="customizedRoute-button" @click="gocustomized">定制路线</button>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pathAttractionList: [],
				selectedImageIndex: 0
			};
		},
		methods: {
			// 定制路线
			gocustomized() {
				uni.navigateTo({
					url: '/packagesIndex/pages/customized/customized'
				})
			},
			// 获取路线推荐详情列表
			async getuserPlanList() {
				let res = await this.$u.api.getuserPlanList()
				if (res.code == 200) {
					this.pathAttractionList = res.rows
				}
			},
			// 跳转详情
			goDetails(id) {
				uni.navigateTo({
					url: `/packagesIndex/pages/AttractionDetail/AttractionDetail?id=${id}`
				})
			}
		},
		onLoad() {
			uni.showLoading({
				title: '加载中...'
			})
			this.getuserPlanList()
			setTimeout(() => {
				uni.hideLoading()
			}, 100)
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		min-height: 95vh;
		padding: 20rpx;
		box-sizing: border-box;
		background-color: #fff;

		.travel.active {
			background: #F3F8FF;
			border: 2rpx solid #096EF4;
		}

		.title {
			display: flex;
			align-items: center;
			margin: 20rpx 0;

			text {
				font-weight: 600;
				font-size: 32rpx;

				&:nth-child(1) {
					width: 10rpx;
					height: 30rpx;
					display: block;
					background-color: $overall-color;
					margin-right: 15rpx;
				}
			}
		}

		.u-scroll {
			.scroll-boxImage {
				width: 318rpx;
				height: 206rpx;
				margin-right: 20rpx;
				border-radius: 20rpx;
			}

			.scroll-title {
				font-weight: 600;
				font-size: 28rpx;
				color: #000000;
				margin: 10rpx 0;
			}

			.scroll-bottom {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin: 10rpx;

				.scroll-bottom-left {
					display: flex;
					align-items: center;

					.scroll-bottom-image {
						width: 30rpx;
						height: 30rpx;
					}

					.scroll-bottom-name {
						font-weight: 400;
						font-size: 24rpx;
					}
				}

				.scroll-bottom-right {
					display: flex;
					align-items: center;

					.scroll-bottom-right-browse {
						font-weight: 400;
						font-size: 24rpx;
						color: #999999;
					}
				}

			}
		}

		.customizedRoute {
			padding: 30rpx 0 50rpx 0;
			width: 720rpx;
			position: fixed;
			bottom: 0;
			background-color: #fff;

			.customizedRoute-button {
				width: 100%;
				color: #fff;
				background-color: $overall-color;
				text-align: center;
				padding: 20rpx;
				box-sizing: border-box;
				border-radius: 20rpx;
			}
		}
	}
</style>